<?php

namespace app\validate;

use share\validate\SceneValidate;

class UserDeviceShareValidate extends SceneValidate{

    protected $rule = [
        'state' => 'require|min:16',
        'encode' => 'require|min:30',
        'userId' => 'require|min:30',
        'token' => 'require|min:30',
        'userIdentity' => 'require|min:10',
        'qrcode' => 'require|min:1|max:250',
        'info' => 'require|array',
        'deviceName' => 'require|min:10|max:120',
        'productKey' => 'require|min:10|max:120',
        'queryTime' => 'require|number|>=:1',
        'iotId' => 'require|min:10|max:64',
        'chNum' => 'require|number|>=:0|<=:512',
        'mainId' => 'require|min:10|max:64',
        'shareId' => 'require|min:30',
        'rule' => 'require|max:20000',
    ];    

    protected $sceneRules = [
        'list' => [
            'userId' => 'length:2,60',
            'mainId' => 'length:2,64',
        ],
    ];

    protected $scene = [
        'addByUser' => ['userId','token','userIdentity','qrcode','state','encode'],
        'addByAdmin' => ['userId','token','userIdentity','qrcode','serverSite','qrcode','info','state','encode'],
        'getRule' => ['userId','token','state','encode'],
        'changeRule' => ['userId','token','info','state','encode'],
        'changeRuleInfo' => ['rule'],
        'del' => ['userId','token','state','encode'],
        'delV2' => ['userId','token','info','state','encode'],
        'delV2Info' => ['mainId','shareId'],
        'getCountInfo' => ['mainId','userId','token','state','encode'],
        'getShareUserInfo' => ['info','userId','token','state','encode'],
        'toShare' => ['userIdentity','serverSite','info','userId','token','state','encode'],
        'toShareInfo' => ['iotId','mainId','deviceName','rule','chNum','shareId','shareIdentity'],
        'infoDetail' => ['iotId','mainId','deviceName','rule','chNum'],
        'list' => ['mainId','userId']
    ];
}